import request from "../utlis/Request"



export default{
    userRegist(name,pwd){
       return request({
        method: 'post',
        url: '/user/regist',
        data:{
            name: name,
            password: pwd
        }
       })
    },
    userLogin(name,pwd){
        return request({
         method: 'post',
         url: '/user/login',
         data:{
             name: name,
             password: pwd
         }
        })
     },
     LoginOut(name,userId){
        return request({
            method: 'post',
            url: '/user/loginOut',
            data: {
                name: name,
                id: userId
            }
        })
     },
     UserInfo(){
        return request({
            method: 'get',
            url: '/user/userInfo',
            params: {
                id: sessionStorage.getItem("userId")
            }
        })
     },
     setUserInfo(user){
        return request({
            method: 'put',
            url: '/user/setUserInfo',
            data: user
        })
     },
     setUserPwd(id,name,oldPwd,yearPwd){
        return request({
            method: 'put',
            url: '/user/setUserPwd',
            data: {
                id: id,
                name: name,
                oldPwd: oldPwd,
                yearPwd: yearPwd
            }
        })
     },
     queryUserList(name,iphone,status){
        return request({
            method: 'get',
            url: '/user/queryUserList',
            params: {
                name: name,
                iphone: iphone,
                status: status
            }
        })
     },
     insertUser(name,password,sex,age,iphone,emil,avatar,status,auth){
        return request({
            method: 'post',
            url: '/user/insertUser',
            data: {
                name: name,
                password: password,
                sex: sex,
                age: age,
                iphone: iphone,
                emil: emil,
                avatar: avatar,
                status: status,
                auth:auth
            }
        })
     },
     queryUser(id){
        return request({
            method: 'get',
            url: '/user/queryUser',
            params: {
                id: id
            }
        })
     },
     deleteUser(id){
        return request({
            method: 'get',
            url: '/user/deleteUser',
            params:{
                id:id
            }
        })
     },
     updateUser(id,name,password,sex,age,iphone,emil,avatar,status,auth){
        return request({
            method: 'put',
            url: '/user/updateUserInfo',
            data: {
                id: id,
                name: name,
                password: password,
                sex: sex,
                age: age,
                iphone: iphone,
                emil: emil,
                avatar: avatar,
                status: status,
                auth:auth
            }
        })
     },
     updateUserStatus(id,status){
        return request({
            method: 'put',
            url: '/user/updateUserStatus',
            data: {
                id: id,
                status: status
            }
        })
     },

     queryUserAccountList(){
        return request({
            method: 'get',
            url: '/user/queryUserAccontList',
        })
     },

     queryUserByid(id){
        return request({
            method: 'get',
            url: '/user/queryUserByid',
            params: {
                id: id
            }
        })
     },

     queryManageUser(flage){
        return request({
            method: 'get',
            url: '/user/queryManageUser',
            params: {
                emil: flage
            }
        })
     }
}